Put toolbars in handleboxes.
authorMatthias Clasen <maclas@gmx.de>
Fri, 29 Aug 2003 23:33:54 +0000 (23:33 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Fri, 29 Aug 2003 23:33:54 +0000 (23:33 +0000)
2003-08-30  Matthias Clasen  <maclas@gmx.de>

* tests/testmerge.c (add_widget): Put toolbars in handleboxes.

* gtk/gtkuimanager.[hc]: Add a boolean property, "add_tearoffs" with
setter and getter. If it is set, add tearoff menu items to regular
menus, but not to popups. Add a signal "changed", which gets emitted
when the merged ui has changed.

* tests/testmerge.c: Add button to test the generation of tearoff
menu items.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkuimanager.c
gtk/gtkuimanager.h

index c828fb2f316faba6ae1e3d67c1485b601985c21c..977e0c6446104f83bb9c859b5d69cca591609b39 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,7 +4,8 @@
 
        * gtk/gtkuimanager.[hc]: Add a boolean property, "add_tearoffs" with 
        setter and getter. If it is set, add tearoff menu items to regular 
-       menus, but not to popups.
+       menus, but not to popups. Add a signal "changed", which gets emitted
+       when the merged ui has changed.
 
        * tests/testmerge.c: Add button to test the generation of tearoff 
        menu items.
index c828fb2f316faba6ae1e3d67c1485b601985c21c..977e0c6446104f83bb9c859b5d69cca591609b39 100644 (file)
@@ -4,7 +4,8 @@
 
        * gtk/gtkuimanager.[hc]: Add a boolean property, "add_tearoffs" with 
        setter and getter. If it is set, add tearoff menu items to regular 
-       menus, but not to popups.
+       menus, but not to popups. Add a signal "changed", which gets emitted
+       when the merged ui has changed.
 
        * tests/testmerge.c: Add button to test the generation of tearoff 
        menu items.
index c828fb2f316faba6ae1e3d67c1485b601985c21c..977e0c6446104f83bb9c859b5d69cca591609b39 100644 (file)
@@ -4,7 +4,8 @@
 
        * gtk/gtkuimanager.[hc]: Add a boolean property, "add_tearoffs" with 
        setter and getter. If it is set, add tearoff menu items to regular 
-       menus, but not to popups.
+       menus, but not to popups. Add a signal "changed", which gets emitted
+       when the merged ui has changed.
 
        * tests/testmerge.c: Add button to test the generation of tearoff 
        menu items.
index c828fb2f316faba6ae1e3d67c1485b601985c21c..977e0c6446104f83bb9c859b5d69cca591609b39 100644 (file)
@@ -4,7 +4,8 @@
 
        * gtk/gtkuimanager.[hc]: Add a boolean property, "add_tearoffs" with 
        setter and getter. If it is set, add tearoff menu items to regular 
-       menus, but not to popups.
+       menus, but not to popups. Add a signal "changed", which gets emitted
+       when the merged ui has changed.
 
        * tests/testmerge.c: Add button to test the generation of tearoff 
        menu items.
index c828fb2f316faba6ae1e3d67c1485b601985c21c..977e0c6446104f83bb9c859b5d69cca591609b39 100644 (file)
@@ -4,7 +4,8 @@
 
        * gtk/gtkuimanager.[hc]: Add a boolean property, "add_tearoffs" with 
        setter and getter. If it is set, add tearoff menu items to regular 
-       menus, but not to popups.
+       menus, but not to popups. Add a signal "changed", which gets emitted
+       when the merged ui has changed.
 
        * tests/testmerge.c: Add button to test the generation of tearoff 
        menu items.
index 73982764fafb73148eccc15c080518c1c8ca97fc..57c1386e4f0c4c49027cbb0a3c90d8d715af1015 100644 (file)
@@ -140,6 +140,7 @@ enum
 {
   ADD_WIDGET,
   REMOVE_WIDGET,
+  CHANGED,
   LAST_SIGNAL
 };
 
@@ -231,7 +232,7 @@ gtk_ui_manager_class_init (GtkUIManagerClass *klass)
                  G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
                  G_STRUCT_OFFSET (GtkUIManagerClass, add_widget), NULL, NULL,
                  g_cclosure_marshal_VOID__OBJECT,
-                 G_TYPE_NONE, 1,
+                 G_TYPE_NONE, 1, 
                  GTK_TYPE_WIDGET);
 
   merge_signals[REMOVE_WIDGET] =
@@ -240,8 +241,23 @@ gtk_ui_manager_class_init (GtkUIManagerClass *klass)
                  G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
                  G_STRUCT_OFFSET (GtkUIManagerClass, remove_widget), NULL, NULL,
                  g_cclosure_marshal_VOID__OBJECT,
-                 G_TYPE_NONE, 1,
+                 G_TYPE_NONE, 1, 
                  GTK_TYPE_WIDGET);  
+  /**
+   * GtkUIManager::changed:
+   * @merge: a #GtkUIManager
+   *
+   * The changed signal is emitted whenever the merged UI changes.
+   *
+   * Since: 2.4
+   */
+  merge_signals[CHANGED] =
+    g_signal_new ("changed",
+                 G_OBJECT_CLASS_TYPE (klass),
+                 G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
+                 G_STRUCT_OFFSET (GtkUIManagerClass, changed),  NULL, NULL,
+                 g_cclosure_marshal_VOID__VOID,
+                 G_TYPE_NONE, 0);
   
   g_type_class_add_private (gobject_class, sizeof (GtkUIManagerPrivate));
 }
@@ -1050,6 +1066,8 @@ add_ui_from_string (GtkUIManager *self,
 
   gtk_ui_manager_queue_update (self);
 
+  g_signal_emit (self, merge_signals[CHANGED], 0);
+
   return ctx.merge_id;
 
  error:
@@ -1163,6 +1181,8 @@ gtk_ui_manager_remove_ui (GtkUIManager *self,
                   remove_ui, GUINT_TO_POINTER (merge_id));
 
   gtk_ui_manager_queue_update (self);
+
+  g_signal_emit (self, merge_signals[CHANGED], 0);
 }
 
 /* -------------------- Updates -------------------- */
@@ -1683,15 +1703,15 @@ update_node (GtkUIManager *self,
     }
 
   /* handle cleanup of dead nodes */
-  if (node->children == NULL && NODE_INFO (node)->uifiles == NULL)
+  if (node->children == NULL && info->uifiles == NULL)
     {
-      if (NODE_INFO (node)->proxy)
-       gtk_widget_destroy (NODE_INFO (node)->proxy);
-      if ((NODE_INFO (node)->type == GTK_UI_MANAGER_MENU_PLACEHOLDER ||
-          NODE_INFO (node)->type == GTK_UI_MANAGER_TOOLBAR_PLACEHOLDER) &&
-         NODE_INFO (node)->extra)
-       gtk_widget_destroy (NODE_INFO (node)->extra);
-      g_chunk_free (NODE_INFO (node), merge_node_chunk);
+      if (info->proxy)
+       gtk_widget_destroy (info->proxy);
+      if ((info->type == GTK_UI_MANAGER_MENU_PLACEHOLDER ||
+          info->type == GTK_UI_MANAGER_TOOLBAR_PLACEHOLDER) &&
+         info->extra)
+       gtk_widget_destroy (info->extra);
+      g_chunk_free (info, merge_node_chunk);
       g_node_destroy (node);
     }
 }
index 844a39ca0ead6c353cc4d2489b5300c8c5c79b47..c98622ba01a41f9cc8a2be8dcabc2b5b0812af30 100644 (file)
@@ -65,6 +65,7 @@ struct _GtkUIManagerClass {
                           GtkWidget    *widget);
   void (* remove_widget) (GtkUIManager *merge, 
                           GtkWidget    *widget);
+  void (* changed)       (GtkUIManager *merge);
 
   /* Padding for future expansion */
   void (*_gtk_reserved1) (void);